/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bsc.war.form;

import bsc.ejb.entity.ActionPlan;
import bsc.ejb.entity.ActionPlanPerson;
import bsc.ejb.entity.Attachment;
import bsc.ejb.entity.Person;
import bsc.ejb.entity.ScoreCard;
import bsc.ejb.metadata.Colorimetry;
import bsc.war.delegate.DelegateBSC;
import bsc.war.factory.Factory;
import bsc.war.service.FileUtils;
import bsc.war.service.ScoreCardUtils;
import java.util.Date;
import java.util.Map;
import java.util.StringTokenizer;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

//org.apache.commons.validator.GenericValidator
/**
 *
 * @author Miguel Angel
 */
public class DeleteActionPlan extends AbstractController {

    @Override
    protected ModelAndView handleRequestInternal(HttpServletRequest request,
            HttpServletResponse response) throws Exception {

        try {
          DelegateBSC delegate = (DelegateBSC) Factory.getBean("DelegateBSC");

            Long idActionPlan = Long.parseLong(request.getParameter("actionPlan"));
            ActionPlan actionPlan = delegate.findActionPlan(idActionPlan);

            ScoreCardUtils.deleteActionPlan(delegate, actionPlan);

        } catch (Exception e) {
            e.printStackTrace();
        }

        return new ModelAndView("newActionPlan");
    }
}
